package com.yuri.news.domain;

import java.util.List;
import com.yuri.news.entity.User;

/**
 * 返回数据
 * @author Yuri
 *
 * @param <T>
 */
public class Result<T> {
	private Integer code;		// 登录状态
	private List<T> data;		// 返回数据
	private User user;			// 用户信息
	private Pages pages;		// 分页数据
	private String msg;			// 返回提示
	// get和set方法
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public List<T> getData() {
		return data;
	}
	public void setData(List<T> data) {
		this.data = data;
	}
	public Pages getPages() {
		return pages;
	}
	public void setPages(Pages pages) {
		this.pages = pages;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	// 
	public void setSuccess(String msg) {
		// TODO Auto-generated method stub
		this.code = 1;
		this.msg = msg;
	}
	
	public void setError(String msg) {
		this.msg  = msg;
		this.code = -1;
	}
	
	// get和set方法结束
	// toString方法
	@Override
	public String toString() {
		return "[code=" + code + ", data=" + data + ", user=" + user + ", pages=" + pages + ", msg=" + msg + "]";
	}
}
